import 'npc.dart';

class NPCFactory {
  static Map<String, NPCFactory> factoryMap = {};
  static void addFactoryForType(NPCFactory factory, String type) {
    factoryMap[type] = factory;
  }

  static NPCFactory factoryForType(String type) {
    NPCFactory factory = factoryMap[type];
    return factory ?? NPCFactory();
  }

  static newNPCWithType(String type, Map map) {
    NPCFactory factory = NPCFactory.factoryForType(type);
    return factory.newNPC(map);
  }

  NPC newNPC(Map map) {
    return NPC(map);
  }
}